using Abp.Timing.Timezone;
using L._52ABP.Application.Dtos;
using System.Collections.Generic;
using Yozeev.BusinessLogic.Dtos;
using Yozeev.DataExporting.Excel.Epplus;
using Yozeev.DataFileObjects.DataTempCache;
using Yozeev.SystemConfig.BasicConfig.Dtos;

namespace Yozeev.UserManagement.Users.Exporting
{
    public class BranchListExcelExporter : EpplusExcelExporterBase, IBranchListExcelExporter
    {

        private readonly ITimeZoneConverter _timeZoneConverter;

        public BranchListExcelExporter(IDataTempFileCacheManager dataTempFileCacheManager, ITimeZoneConverter timeZoneConverter) : base(
            dataTempFileCacheManager)
        {
            _timeZoneConverter = timeZoneConverter;
        }

        public FileDto ExportToExcel(List<BranchListDto> branchListDtos)
        {
            var excel =
                CreateExcelPackage("BrancherList.xlsx", excelpackage =>
                {
                    var sheet = excelpackage.Workbook.Worksheets.Add(L("Branchs"));
                    sheet.OutLineApplyStyle = true;
                    AddHeader(sheet,
                        L("BranchCode"),
                        L("BranchName"),
                        L("Sort"),
                        L("Level"),
                        L("IsEnabled"),
                        L("CreateId"),
                        L("CreationTime"));

                    AddObject(sheet, 2, branchListDtos,
                        ex => ex.BranchCode,
                        ex => ex.BranchName,
                        ex => ex.Sort,
                        ex => ex.Level,
                        ex => ex.IsEnabled,
                        ex => AbpSession.UserId,
                        ex => ex.CreationTime
                       );

                   

                    //var createTimeColumn = sheet.Column(3);
                    //createTimeColumn.Style.Numberformat.Format = "yyyy-mm-dd";
                });



            return excel;
        }
    }
}